package atdd.kata.core;

import atdd.kata.core.domain.Person;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;

public class CustomMatchers {

    public static Matcher<Person> sameAs(final Person person) {
        return new BaseMatcher<Person>() {
            @Override
            public boolean matches(final Object item) {
                return EqualsBuilder.reflectionEquals(item, person);
            }

            @Override
            public void describeTo(Description description) {
                description.appendText("person should be: ").appendValue(person.toString());
            }
        };
    }

}
